<template>
    <div class='bgff pd pt10 pm10 aboutUs'>
    <div class="productCenter-top">
        <img :src="form.head.img" class="productCenter-top-img">
        <div class="wd pr h100"  @click="photoShowModal = true">
            <div class="vertical-center tl h100">
                <div  @click.stop="nullfun" class="w100">
                    <p class="fz18 cf">
                        <n-input v-model:value="form.head.msg" type="text" placeholder="" size="medium"
                                clearable></n-input>
                    </p>
                    <div class="title-text fz32 flex-1 cf mt10">
                        <n-input class="fz32" v-model:value="form.head.title" type="text" placeholder=""
                                size="medium" clearable></n-input>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <n-modal v-model:show="photoShowModal" preset="card" class="Stock-diagnosis">
        <template #header>
            <div>头图</div>
        </template>
        <div>
            <photoGallery @getImg="getImg" types="迪聚海思头图"></photoGallery>
        </div>
        <template #action>
            <div class="tr">
                <n-button @click="photoShowModal = false"> 取消 </n-button>
                <n-button class="ml10" type="info" @click="setImg"> 确定 </n-button>
            </div>
        </template>
    </n-modal>
        
    <div class="aboutUs-bottom vertical-center">
            <div>
                <n-button type="primary" size="medium" @click="aboutSave">保存</n-button>
                <n-button type="primary" size="medium" @click="callBack" class="ml20">返回上一页</n-button>
            </div>
            
        </div>
    </div>
</template>
 <script lang='ts' setup>
 import { ref } from "vue"
import { callBack, dxpost, qurl, dxget } from "../../../util/index"
import photoGallery from "../../../components/util/photoGallery";
const photoShowModal = ref(false)
const form = ref({
    head: {
        img: "",
        title: "",
        msg: ""
    }
})

let jjnmnxe = "";
const getImg = (data) => {
    jjnmnxe = data;
};
const setImg = () => {
    form.value.head.img = jjnmnxe;
    photoShowModal.value = false;
};



const aboutSave = async()=>{
   const {errno}:any =  await dxpost("djhs/djsinglePage",{
        id:3,
        detail:JSON.stringify(form.value)
    },"put")
    if(errno==0){
        window.$message.success("操作成功！")
    }
}

const getdetail = async ()=>{
  const {data}:any=  await dxget("djhs/djsinglePage",{id:3})
  if(data.detail){
    form.value= JSON.parse(data.detail)
  }
  
}
getdetail()
const nullfun = () => {
    console.log('66');
}
</script>
 <style scoped>
</style>